import { Injectable } from '@angular/core';

import axios from 'axios'

@Injectable({
  providedIn: 'root'
})
export class AxiosService {

  constructor() { }

  get(url, success, failure) {
    axios.get(url).then(res => {
      success(res)
    }).catch(error => {
      failure(error)
    })
  }

  post(url, param, success, failure) {
    axios.post(url, param).then(res => {
      success(res)
    }).catch(error => {
      failure(error)
    })
  }

  // 集成get和post
  request(method, url) {

  }
}
